$(function() {
  // 区域滚动
  mui(".mui-scroll-wrapper").scroll({
    deceleration: 0.0005, //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
    indicators: false //是否显示滚动条
  });
});
// 鼠标拖动登录按钮
var div1 = document.querySelector(".lt-login-ball");
//限制最大宽高，不让滑块出去
var maxW = document.querySelector(".lt-main").clientWidth - div1.offsetWidth;
var maxH = document.querySelector(".lt-main").clientHeight - div1.offsetHeight;
//手指触摸开始，记录div的初始位置
div1.addEventListener("touchstart", function(e) {
  var ev = e || window.event;
  var touch = ev.targetTouches[0];
  oL = touch.clientX - div1.offsetLeft;
  oT = touch.clientY - div1.offsetTop;
  // document.addEventListener("touchmove", defaultEvent, false);
});
//触摸中的，位置记录
div1.addEventListener("touchmove", function(e) {
  var ev = e || window.event;
  var touch = ev.targetTouches[0];
  var oLeft = touch.clientX - oL;
  var oTop = touch.clientY - oT;
  if (oLeft < 0) {
    oLeft = 0;
  } else if (oLeft >= maxW) {
    oLeft = maxW;
  }
  if (oTop < 50) {
    oTop = 50;
  } else if (oTop >= maxH) {
    oTop = maxH;
  }
  div1.style.left = oLeft + "px";
  div1.style.top = oTop + "px";
});
// // 触摸结束时的处理
// div1.addEventListener("touchend", function() {
//   document.removeEventListener("touchmove", defaultEvent);
// });
// // 阻止默认事件
// function defaultEvent(e) {
//   e.preventDefault();
// }
